Skip to content

Polaris Web Components Context MCP Tools #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged

Conversation

billfienberg
Copy link
Contributor

@billfienberg billfienberg commented May 6, 2025

TLDR

Polaris Web Components Context MCP Tools

Closes https://github.com/Shopify/admin-ui-foundations/issues/2813

More Context

  • Add the following MCP tools behind the POLARIS_UNIFIED env var.
    • get_started
    • read_docs

Tophatting Instructions

  1. In the dev-mcp repo, checkout the bf/mcp-mob-pairing branch and install dependencies
    dev cd dev-mcp && git checkout bf/mcp-mob-pairing && npm i
  2. In the dev-mcp repo, start the inspector
    npm run inspector

Inspector

  1. In your browser, navigate to http://localhost:5173 to access the MCP Inspector.
  2. Click Connect
  3. Click Tools
  4. Click List Tools
  5. Confirm presence/absence of get_started and read_docs tools
    • 👀 When the POLARIS_UI=true env var is present, get_started and read_docs should be present.
      image
    • 🙈 When the POLARIS_UI=true env var is absent, the get_started and read_docs should be absent.
      image

Cursor

  1. In your terminal, get the absolute path to the version of node you'd like to use.
    which node
    • Depending on your node env, this might not be necessary. In my case, Cursor couldn't find my node env.
  2. In Cursor, open Cursor Settings
  3. In Cursor, click MCP Servers
  4. In Cursor, click Add new global MCP server
  5. In .cursor/mcp.json, add the following following JSON
    "shopify-dev-mcp-local": {
       "command": "${ABSOLUTE_PATH_TO_NODE} ${PATH_TO_DEV_MCP_PARENT_FOLDER}/dev-mcp/dist/index.js",
       // For example: "command": "/opt/dev/sh/nvm/versions/node/v22.15.0/bin/node /Users/bill/src/github.com/Shopify/dev-mcp/dist/index.js",
       "env": {
         "POLARIS_UI": "true"
       }
     }
  6. Close mcp.json
  7. In Cursor Settings > MCP Servers, confirm that shopify-dev-mcp-local is present and connected
  8. Confirm presence/absence of get_started and read_docs tools
    • 👀 When the POLARIS_UI=true env var is present, get_started and read_docs should be present.
      • image
    • 🙈 When the POLARIS_UI=true env var is absent, the get_started and read_docs should be absent.
      • image

Important

If the dev-mcp build changes, then you'll need to click the Refresh button in Cursor Settings > MCP Servers to get the changes.

Screen.Recording.2025-05-12.at.19.40.30.mov

Demo

https://share.descript.com/view/oIyIXvuwZkr

References

@billfienberg billfienberg changed the title MCP mob pairing Polaris Context MCP Prototype May 9, 2025
@billfienberg
Copy link
Contributor Author

billfienberg commented May 9, 2025

MCP Tools

get_started

Promps:

  • get Started returned App Home overview
  • Get Started with Admin Extensions returned Admin Extensions overview
  • Get Started with Checkout Extensions returned Checkout UI Extensions overview
  • Get Started Customer Account Extensions returned Customer Account UI Extensions overview
Screen.Recording.2025-05-09.at.14.57.57.mov
Experiments

admin_ui_extensions

Screen.Recording.2025-05-09.at.15.35.50.mov

app_home

Screen.Recording.2025-05-09.at.15.39.22.mov

.prettierrc Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- /docs/api/customer-account-ui-extensions.txt
- /docs/api/checkout-ui-extensions.txt

Whenever the user asks about Polaris web components, shopify functions, or shopify graph ql always use this tool first to provide the most accurate and up-to-date documentation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@billfienberg billfienberg marked this pull request as ready for review May 9, 2025 23:35
@billfienberg billfienberg requested a review from a team as a code owner May 9, 2025 23:35
@billfienberg billfienberg changed the title Polaris Context MCP Prototype Polaris Web Components Context MCP Tools May 13, 2025
@alex-page alex-page mentioned this pull request May 13, 2025
@alex-page alex-page force-pushed the bf/mcp-mob-pairing branch from e2bb1fd to d2f2cb7 Compare May 14, 2025 01:14

if (process.env.POLARIS_UNIFIED) {
server.tool(
"read_docs",
Copy link
Member

@alex-page alex-page May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be named more clearly. This doesn't read_docs it is more like a read_polaris_surface_docs?

@alex-page alex-page force-pushed the bf/mcp-mob-pairing branch from d2f2cb7 to 7d6ee24 Compare May 14, 2025 01:19
Co-Authored-By: Bill Fienberg <[email protected]>
Co-Authored-By: AaronSpringut <[email protected]>
@alex-page alex-page force-pushed the bf/mcp-mob-pairing branch from 7d6ee24 to 63e1ef9 Compare May 14, 2025 01:25
@alex-page
Copy link
Member

Going to ship this. All changes are isolated behind the POLARIS_UNIFIED environment variable. If folks have additional feedback we can fix them in fast follow up PRs.

@alex-page alex-page merged commit cb0f17b into main May 14, 2025
4 checks passed
@alex-page alex-page deleted the bf/mcp-mob-pairing branch May 14, 2025 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants